package me.leiusual.sharing.ui.shop.adapter

import android.view.View
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.extensions.LayoutContainer
import kotlinx.android.synthetic.main.view_holder_shop_manage.*

/**
 * author: leiusual
 * create on: 2019-08-10
 * description:
 */
class ShopManageViewHolder(
    override val containerView: View,
    private val clickListener: (Long) -> Unit
) : RecyclerView.ViewHolder(containerView), LayoutContainer, View.OnClickListener {

  private lateinit var item: ShopManageAdapter.Item

  init {
    containerView.setOnClickListener(this)
  }

  fun bind(entry: ShopManageAdapter.Item) {
    this.item = entry

    text_view.text = entry.storeName
  }

  override fun onClick(v: View?) {
    clickListener(item.storeId)
  }
}